﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperWebSocket.SubProtocol;

namespace WebCommand.Command
{
    public class CHAT : JsonSubCommand<MySession,ChatData>
    {
        protected override void ExecuteJsonCommand(MySession session, ChatData commandInfo)
        {
            session.SendResponseAsync(string.Format("CHAT 你对{0}悄悄话:{1}", commandInfo.UserName, commandInfo.Message));

            var userSession = session.Server.GetSessionByUserName(commandInfo.UserName);
            if (userSession != null)
            {
                userSession.SendResponseAsync(string.Format("CHAT {0}对你悄悄话:{1}", session.UserName, commandInfo.Message));
            }
        }
    }
}
